<!--
 * @Author: houmin 745762351@qq.com
 * @Date: 2023-11-29 15:43:54
 * @LastEditors: houmin 745762351@qq.com
 * @LastEditTime: 2023-12-03 20:20:47
 * @FilePath: \tch-h5\src\views\home\components\GoldPandaCard.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<script setup>
import { useRouter } from "vue-router";
import { defineProps, ref, watch } from "vue";
// import panda from "@/assets/images/oneCard/panda.png";
import qr from "@/assets/images/oneCard/qr.png";

const props = defineProps({
  data: Object,
});

const router = useRouter();
const Info = ref({});

watch(
  () => props.data,
  (newValue) => {
    Info.value = newValue;
  },
  { immediate: true, deep: true }
);
</script>

<template>
  <div class="card">
    <div class="name">金熊猫卡</div>
    <div class="content">
      <div class="avatar">
        <van-image width="130" height="100%" :src="Info?.value?.coverImage" />
      </div>
      <div class="details">
        <p
          @click.stop="
            () =>
              router.push({
                path: 'panda-details',
                query: {
                  cardId: Info?.value?.cardId,
                },
              })
          "
        >
          <img
            src="@/assets/images/icons/year-card.png"
            width="26"
            alt=""
          />年卡购买
        </p>
        <p @click.stop="() => router.push('/goldenCard/activation')">
          <img
            src="@/assets/images/icons/card-active.png"
            width="26"
            alt=""
          />年卡激活
        </p>
        <p @click.stop="() => router.push('/my-card')">
          <img
            src="@/assets/images/icons/my-card.png"
            width="26"
            alt=""
          />我的年卡
        </p>
        <p
          style="font-weight: bold; font-size: 1.6rem"
          @click="() => router.push(`/goldenCard/signedscenicspots`)"
        >
          <img
            src="@/assets/images/icons/sun.png"
            width="26"
            alt=""
          />签约景区列表<van-icon name="arrow" />
        </p>
        <div class="qr" @click="() => router.push({
          path:`input-code`,
          query:{
            cardId: Info?.value?.cardId,
          }
          })">
          <van-image width="80" height="80" :src="qr" />
          <p>入园码</p>
        </div>
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.card {
  overflow: hidden;
  background-color: #ffffff;
  border-radius: 1rem;
  padding: 0.5rem;
  margin: 1.5rem;
  // box-shadow: 0 0.7rem 1.5rem 0 rgba(54, 141, 88, 0.05);
  box-shadow: 2px 2px 6px rgba(189, 189, 189, 0.7);
  .name {
    margin: 1rem 0 1rem 1rem;
    font-weight: bold;
    font-size: 1.6rem;
  }
  .content {
    display: flex;
  }
  .avatar {
    margin-right: 1rem;
  }
  .details {
    position: relative;
    font-size: 1.4rem;
    line-height: 1.5;
    flex: 1;
    margin-top: 2rem;
    .qr {
      position: absolute;
      right: 1rem;
      top: -1rem;
      font-size: 1.2rem;
      p {
        text-align: center;
        font-weight: bold;
      }
    }
    img {
      margin-right: 0.5rem;
      margin-bottom: 1rem;
      vertical-align: middle;
    }
  }
}
</style>
